import { EntityModel } from '@midwayjs/orm';
import { Column, JoinColumn, ManyToOne, OneToOne } from 'typeorm';
import { BaseModel } from '../utils/base.model';
import { TbFlow } from './TbFlow';
import { User } from './User';

/**
 * 流程节点表
 */
@EntityModel()
export class TbFlowNode extends BaseModel {
  @Column({
    comment: '流程ID',
  })
  flowId: number;

  @ManyToOne(() => TbFlow, flow => flow.nodes)
  @JoinColumn()
  flow: TbFlow;

  @Column({
    comment: '名称',
  })
  name: string;

  @Column({
    nullable: true,
    comment: '角色',
  })
  role: string;

  @Column({
    comment: '用户ID',
  })
  userId: number;

  @ManyToOne(() => User)
  @JoinColumn()
  user: User;

  @Column({
    nullable: true,
    comment: '备注',
  })
  remark: string;
}
